package com.apartment.dao;

import com.apartment.data.entity.User;
import org.springframework.data.jpa.repository.JpaRepository;
import org.springframework.data.jpa.repository.Query;

/**
 * Author : xuzhiyong
 * Date : 2022/5/27 22:33
 */
public interface UserDao extends JpaRepository<User, Integer> {
    User findByUsernameAndPassword(String username,String password);

    @Query(value = "select u.id,u.username,u.password,u.sex,u.phone,u.mail from User u where u.username like ?1",nativeQuery = true)
    User findUserByUsername(String username);

    User findByUsernameAndMail(String username, String mail);

    @Query(value = "select u.id,u.username,u.password,u.sex,u.phone,u.mail from User u where u.mail like ?1",nativeQuery = true)
    User findUserByMail(String mail);
}
